package com.itgaohe.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itgaohe.common.context.UserContext;
import com.itgaohe.dao.entity.Follow;
import com.itgaohe.dao.mapper.FollowMapper;
import com.itgaohe.service.FollowService;
import org.springframework.stereotype.Service;

@Service
public class FollowServiceImpl extends ServiceImpl<FollowMapper, Follow> implements FollowService {
    @Override
    public Boolean searchOrNotFollow(int userId) {
        LambdaQueryWrapper<Follow> eq = Wrappers.lambdaQuery(Follow.class)
                .eq(Follow::getUserId, userId)
                .eq(Follow::getFollowUserId, UserContext.getUser().getId());
        Follow one = this.getOne(eq);
        if (one != null) {
            return true ;
        }
        return false ;
    }
}
